home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / program / flip3206.zip / FLIP32.H < prev    next >
C/C++ Source or Header  |  1997-03-23  |  3KB  |  92 lines

  1. // --------------------------------------------------------------------------
  2. //  FLIP32.H             copyright (c) 1996-97, Xavier Defrang (aka brioche)
  3. // --------------------------------------------------------------------------
  4. //  very simple header for a flat 32-bit protected mode animation player
  5. // --------------------------------------------------------------------------
  6. //  e-mail: 106146.1452@compuserve.com
  7. // --------------------------------------------------------------------------
  8.  
  9. #include <STDIO.H>
  10. #include <STDLIB.H>
  11. #include <CONIO.H>
  12.  
  13. #ifndef __FLIP32
  14.  
  15. #define __FLIP32
  16.  
  17. #ifndef __TYPES
  18. #include "TYPES.H"
  19. #endif
  20.  
  21. typedef struct { UDWORD size;
  22.          UWORD magic, frames, scrwd, scrht, depth, flags, speed;
  23.          UDWORD next, frit;
  24.          UBYTE filler[0x66];
  25.            } FLIHEADER;
  26. typedef struct { UDWORD size;
  27.          UWORD magic, chunks;
  28.          UBYTE filler[0x08];
  29.            } FRAMEHEADER;
  30.  
  31. FLIHEADER flihdr;
  32. FRAMEHEADER framehdr;
  33. FILE *flifile;
  34. UDWORD flisize, framecnt;
  35. UBYTE *framebuf;
  36.  
  37. // --------------------------------------------------------------------------
  38.  
  39. BOOL flip32_init( void );                                 // funcs prototypes
  40. void flip32_done( void );
  41. BOOL flip32_load( const char *filename );
  42. void flip32_close( void );
  43.  
  44. // --------------------------------------------------------------------------
  45.  
  46. extern "C" {                                               // assembler routs
  47. void vmode( UDWORD md );
  48. #pragma aux vmode parm[eax] modify[eax];
  49. void flip32_wait( UDWORD pause );
  50. #pragma aux flip32_wait parm[ecx] modify[eax ecx edx];
  51. void flip32_unpack( UBYTE *src, UBYTE *dst, UDWORD chunks );
  52. };
  53.  
  54. // --------------------------------------------------------------------------
  55.  
  56. BOOL flip32_init( void )                // just allocate mem for frame buffer
  57. {
  58.  return( ( framebuf = (UBYTE *)malloc( 0xfffe ) ) != NULL );
  59. }
  60.  
  61. // --------------------------------------------------------------------------
  62.  
  63. void flip32_done( void )                                // flush frame buffer
  64. {
  65.  free( framebuf );
  66. }
  67.  
  68. // --------------------------------------------------------------------------
  69.  
  70. BOOL flip32_load( const char *filename )     // open file and read FLI header
  71. {
  72.  if ( !( flifile = fopen( filename, "rb" ) ) ) return( 0 ); 
  73.  fseek( flifile, 0, SEEK_END );
  74.  flisize = ftell( flifile );
  75.  fseek( flifile, 0, SEEK_SET );
  76.  fread( &flihdr, 128, 1, flifile );
  77.  return( 1 );
  78. }
  79.  
  80. // --------------------------------------------------------------------------
  81.  
  82. void flip32_close( void )                                       // close file
  83. {
  84.  fclose( flifile );
  85. }
  86.  
  87. // --------------------------------------------------------------------------
  88.  
  89. #endif
  90.  
  91. // I told you there was only very basic stuff here! :)
  92.